#ifndef FACE_DETECT_VJ_HH
#define FACE_DETECT_VJ_HH

#include <stdlib.h>
#include <time.h>
#include <exception>
#include <sys/time.h>

#include "boost/smart_ptr.hpp"

#include "cxcore.h"
#include "cv.h"

#include "basic_utils.hh"

const CvSize HAAR_MIN_SIZE = cvSize(120,120);

class HaarDetector{
public:
    HaarDetector();
	
    int load(const char *path = NULL);

    bool set_debug (bool deb){ bool k = m_debug; m_debug = deb; return k;}
    CvScalar set_color(CvScalar col){CvScalar k = m_color; m_color = col; return k;}
    
    //    bool set_stability_check(bool check){book k = m_check_stab;
    //    m_check_stab = check; return k;}

    CvRect detect(IplImage *img, 
		  CvSize min_size = HAAR_MIN_SIZE, 
		  bool do_pyramids = false);
    
    ~HaarDetector(){  
	cvReleaseHaarClassifierCascade( &m_cascade );
    }

private:
    CvHaarClassifierCascade *m_cascade;

    boost::shared_ptr<IplImage> m_pyr2;
    bool m_debug;

    CvScalar m_color;
};
 

#endif
